﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="SubjectGroupInformationDisclosureDomainService.cs" company="ELEN 7045 GROUP II">
//    Contributed by E.Vosloo
// </copyright>
// <summary>
//   The subject group information disclosure domain service
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Domain.StudyDefinition.Services
{
    #region

    using System;
    using System.Collections.Generic;
    using System.Linq;

    using Domain.StudyDefinition.Contracts.DomainServices;
    using Domain.StudyDefinition.Contracts.Repositories.SubjectGroups;
    using Domain.StudyDefinition.Entities;

    #endregion

    /// <summary>
    /// The subject group information disclosure domain service
    /// </summary>
    public class SubjectGroupInformationDisclosureDomainService : ISubjectGroupInformationDisclosureDomainService
    {
        #region Constants and Fields

        /// <summary>
        /// The subject group repository instance.
        /// </summary>
        private readonly ISubjectGroupRepository subjectGroupRepositoryInstance;

        #endregion

        #region Constructors and Destructors

        /// <summary>
        /// Initializes a new instance of the <see cref="SubjectGroupInformationDisclosureDomainService"/> class.
        /// </summary>
        /// <param name="subjectGroupRepository">
        /// The subject group repository.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// </exception>
        public SubjectGroupInformationDisclosureDomainService(ISubjectGroupRepository subjectGroupRepository)
        {
            if (subjectGroupRepository == null)
            {
                throw new ArgumentNullException("subjectGroupRepository");
            }

            this.subjectGroupRepositoryInstance = subjectGroupRepository;
        }

        #endregion

        #region Implemented Interfaces

        #region ISubjectGroupInformationDisclosureDomainService

        /// <summary>
        /// Gets all Studies.
        /// </summary>
        /// <returns>
        /// A list of Studies
        /// </returns>
        public List<SubjectGroup> GetAllSubjectGroups()
        {
            return this.subjectGroupRepositoryInstance.Get().ToList();
        }

        #endregion

        #endregion
    }
}